﻿<%@ Application Language="C#" %>
<%@ Import Namespace="System.Web.Routing" %>

<script runat="server">

    private void RegisterRoutes(RouteCollection routes)
    {
        RouteTable.Routes.MapPageRoute("Region", "{currentpage}/WRREGIONManager.htm", "~/Admin/Pages/WRREGIONManager.aspx");
        RouteTable.Routes.MapPageRoute("Area", "{currentpage}/WRAREAManager.htm", "~/Admin/Pages/WRAREAManager.aspx");
        RouteTable.Routes.MapPageRoute("CategoryLV1", "{currentpage}/WRCATEGORYLV1Manager.htm", "~/Admin/Pages/WRCATEGORYLV1Manager.aspx");
        RouteTable.Routes.MapPageRoute("Category", "{currentpage}/WRCATEGORYManager.htm", "~/Admin/Pages/WRCATEGORYManager.aspx");
        RouteTable.Routes.MapPageRoute("Citizen", "{currentpage}/WRCITIZENManager.htm", "~/Admin/Pages/WRCITIZENManager.aspx");
        RouteTable.Routes.MapPageRoute("City", "{currentpage}/WRCITYManager.htm", "~/Admin/Pages/WRCITYManager.aspx");
        RouteTable.Routes.MapPageRoute("Comment", "{currentpage}/WRCOMMENTManager.htm", "~/Admin/Pages/WRCOMMENTManager.aspx");
        RouteTable.Routes.MapPageRoute("EntSaleType", "{currentpage}/WRENTSALETYPEManager.htm", "~/Admin/Pages/WRENTSALETYPEManager.aspx");
        RouteTable.Routes.MapPageRoute("EntType", "{currentpage}/WRENTTYPEManager.htm", "~/Admin/Pages/WRENTTYPEManager.aspx");
        RouteTable.Routes.MapPageRoute("Entry", "{currentpage}/WRENTRYManager.htm", "~/Admin/Pages/WRENTRYManager.aspx");
        RouteTable.Routes.MapPageRoute("FuncPay", "{currentpage}/WRFUNCPAYManager.htm", "~/Admin/Pages/WRFUNCPAYManager.aspx");
        RouteTable.Routes.MapPageRoute("Language", "{currentpage}/WRLANGUAGEManager.htm", "~/Admin/Pages/WRLANGUAGEManager.aspx");
        RouteTable.Routes.MapPageRoute("Log", "{currentpage}/WRLOGManager.htm", "~/Admin/Pages/WRLOGManager.aspx");
        RouteTable.Routes.MapPageRoute("MediaStore", "{currentpage}/WRMEDIASTOREManager.htm", "~/Admin/Pages/WRMEDIASTOREManager.aspx");
        RouteTable.Routes.MapPageRoute("MediaType", "{currentpage}/WRMEDIATYPEManager.htm", "~/Admin/Pages/WRMEDIATYPEManager.aspx");
        RouteTable.Routes.MapPageRoute("PriceType", "{currentpage}/WRPRICETYPEManager.htm", "~/Admin/Pages/WRPRICETYPEManager.aspx");
        RouteTable.Routes.MapPageRoute("RoleApply", "{currentpage}/WRROLEAPPLYManager.htm", "~/Admin/Pages/WRROLEAPPLYManager.aspx");
        RouteTable.Routes.MapPageRoute("Role", "{currentpage}/WRROLEManager.htm", "~/Admin/Pages/WRROLEManager.aspx");
        RouteTable.Routes.MapPageRoute("Urgent", "{currentpage}/WRURGENTManager.htm", "~/Admin/Pages/WRURGENTManager.aspx");
        RouteTable.Routes.MapPageRoute("UserGroup", "{currentpage}/WRUSERGROUPManager.htm", "~/Admin/Pages/WRUSERGROUPManager.aspx");
        RouteTable.Routes.MapPageRoute("User", "{currentpage}/WRUSERManager.htm", "~/Admin/Pages/WRUSERManager.aspx");
        RouteTable.Routes.MapPageRoute("Login", "Login.htm", "~/Admin/Pages/login.aspx");
        RouteTable.Routes.MapPageRoute("ChangePassword", "ChangePassword.htm", "~/Admin/Pages/ChangePassword.aspx");
        RouteTable.Routes.MapPageRoute("EntryCity", "{cityname}/{idcatelv1}/{catename}", "~/Pages/View.aspx");
        RouteTable.Routes.MapPageRoute("ViewEnt", "{idEntry}/ViewEntry.html", "~/Pages/Viewdetails.aspx");
        RouteTable.Routes.MapPageRoute("ViewOther", "{currentpage}/Page/ViewEntry.html", "~/Pages/View.aspx");
        RouteTable.Routes.MapPageRoute("Home", "Page/home.html", "~/Pages/Default.aspx");
        RouteTable.Routes.MapPageRoute("List_category", "{catename}/list.html", "~/Pages/View.aspx");
        RouteTable.Routes.MapPageRoute("HomeOther", "{currentpage}/Page/home.html", "~/Pages/Default.aspx");
        RouteTable.Routes.MapPageRoute("About", "Page/about.html", "~/Pages/About.aspx");
        RouteTable.Routes.MapPageRoute("Terms_of_Use", "Page/Terms_of_Use.html", "~/Pages/Terms_of_Use.aspx");
        RouteTable.Routes.MapPageRoute("Privacy_Policy", "Page/Privacy_Policy.html", "~/Pages/Privacy_Policy.aspx");
        RouteTable.Routes.MapPageRoute("Posting_Policies", "Page/Posting_Policies.html", "~/Pages/Posting_Policies.aspx");
        RouteTable.Routes.MapPageRoute("PostEntry", "Page/PostEntry.html", "~/Pages/PostEntry.aspx");
        RouteTable.Routes.MapPageRoute("Priority", "Page/Priority.html", "~/Pages/Priority.aspx");
        RouteTable.Routes.MapPageRoute("Often", "Page/Often.html", "~/Pages/Often.aspx");
        
        
    }

    void Application_Start(object sender, EventArgs e) 
    {
        // Code that runs on application startup
        RegisterRoutes(RouteTable.Routes);
        
    }
    
    void Application_End(object sender, EventArgs e) 
    {
        //  Code that runs on application shutdown
        
    }
        
    void Application_Error(object sender, EventArgs e) 
    { 
        // Code that runs when an unhandled error occurs

    }

    void Session_Start(object sender, EventArgs e) 
    {
        // Code that runs when a new session is started
        Session["Area"] = -1;
        Session["Region"] = -1;
        Session["City"] = -1;
        Session["ListCity"] = "";
        Session["userid"] = "";
        Session["Username"] = "";
        Session["CateID"] = "";
        Session["CityName"] = "";
        Session["SelLang"] = "en";
        HttpCookie cookie = new HttpCookie("SelLang");
        cookie.Value = "";
        Response.Cookies.Add(cookie);
    }

    void Session_End(object sender, EventArgs e) 
    {
        // Code that runs when a session ends. 
        // Note: The Session_End event is raised only when the sessionstate mode
        // is set to InProc in the Web.config file. If session mode is set to StateServer 
        // or SQLServer, the event is not raised.
        HttpCookie cookie = Request.Cookies["SelLang"];
        if (cookie != null)
        {
            cookie.Expires = DateTime.Now.AddHours(-1);
        }
        Session["SelLang"] = "en";
    }
       
</script>
